package com.example.consumer2;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * <b>TODO . </b>
 *
 * @author yangyl11
 * @version 1.0.0
 * @date 2020/11/9
 * @since JDK 1.8
 */
@RestController
public class TestController {

	private Logger logger = LoggerFactory.getLogger(TestController.class);

	@Resource
	private RemoteService remoteService;

	@Resource
	private RestTemplate restTemplate;

	@RequestMapping("/test1")
	public String test1() {

		logger.info("test1");
		return restTemplate.getForObject("http://provider2/test", String.class);
	}

	@RequestMapping("/consumer/test1")
	public String test2() {

		logger.info("test2");
		return remoteService.test1();
	}
}
